<template>
  <el-dialog title="详细信息"
    :visible="dialogVisible"
    width="650px"
    @close="close">
    <el-form :model="ruleForm" ref="ruleForm" label-width="140px" class="demo-ruleForm">
      <el-row>
        <el-col :span="12">
          <el-form-item label="任务名称：" prop="name">
            {{ ruleForm.name }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="调用目标字符串：" prop="invoke_target">
            {{ ruleForm.invoke_target }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="cron执行表达式：" prop="cron_expression">
            {{ ruleForm.cron_expression }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="通知邮箱：" prop="email">
            {{ ruleForm.email }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="创建时间：" prop="ctime">
            {{ ruleForm.ctime }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="更新时间：" prop="mtime">
            {{ ruleForm.mtime }}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="状态：" prop="status">
            {{ ruleForm.status === true ? '启用' : '停用' }}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <dmavon-editor :content.sync="ruleForm.content" :isEdit="false" />
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="close">关 闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
import dmavonEditor from '@/components/mavonEditor'
export default {
  components: {
    dmavonEditor
  },
  data () {
    return {
      ruleForm: {
        name: '',
        sort: '',
        status: true,
        remark: ''
      }
    }
  },
  props: {
    dialogVisible: {
      type: Boolean
    }
  },
  methods: {
    close () {
      this.$emit('update:dialogVisible', false)
    },
    detaliInfo (id) { // 根据id获取详情
      this.$emit('update:dialogVisible', true)
      this.$API({
        name: 'DetailTask',
        paths: [id],
        requireAuth: true
      }).then (res => {
        if (res.data.code === 200) {
          this.ruleForm = res.data.data
        } else {
          this.$message.error(res.data.msg)
        }
      }).catch(error => {
        this.$message.error(error)
      })
    }
  }
}
</script>

<style>

</style>